<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
</head>

<script type = "text/javascript" language = "javascript">

function numbersOnly(obj)
{
    var str = obj.value;
   
    if(str.length > 0)
    {/*
        if(isNaN(str) == true )
        {
            alert("숫자만 입력 가능합니다");
            obj.value = "";
            return false;
        }  
    */
    }
    
    var regEx_hp_N = new RegExp("[0-9]");
    
 
    
    for(var  i = 0 ; i < str.length ; i++){
        
        var str1 = str.charAt(i);
     
        var result_hp = regEx_hp_N.exec(str1);
        if(!result_hp)
       {    
            alert("숫자만 입력 가능합니다");
            obj.value = "";
            return false;        
       }
       
               
    }
     

    return true;
    
}

function findNewId(){
    
    var frm = $("#findNewIdForm")[0];


 
    var mbrNm = document.getElementById("mbrNm");
    var mobileCom = document.getElementById("mobileCom");
    var telPrx = document.getElementById("telPrx");
    var telTail = document.getElementById("telTail");


    if (mbrNm.value == "") {
        alert("성명을  입력하십시요");
        mbrNm.focus;
        return ;
    }
    if (telPrx.value == "") {
        alert("휴대전화 번호 앞자리를 입력하십시요");
        telPrx.focus();
        return ;
    }    
    if (telTail.value == "") {
        alert("휴대전화 번호 뒷자리를 입력하십시요");
        telTailx.focus();
        return ;
    }     
    
    var fullHpNo = mobileCom.value + '-' + telPrx.value + '-' +telTail.value ; 
    
 
    $.post("<c:url value='/mbr/findNewId.do'/>",
               {
                   'mbrNm'        : mbrNm.value,
                   'fullHpNo'     : fullHpNo
               },
               function(data){
                   var newIdList=[];
                   var items = $(data).find("item");
                   var ite = items.size();
                   items.each(function(index,element){
                      var object={};
                      var newId = $(this).find("value").eq(0).text();

                      object["newId"] = newId;


                      newIdList[index] = object;
                   });
                  
                   
                   var inHtml = '';
                   
                   var findView = document.getElementById("findView");
                   var findIdRst = document.getElementById("findIdRst");
                   findView.style.display = "none";
                   findIdRst.style.display = "block";                   
                   if(newIdList.length > 0){

                       for(var i=0; i<newIdList.length; i++){
                           //신주소
                            inHtml = inHtml + '<div class="newId">' + newIdList[i]["newId"] + '</div>';
                          }
                   }
                   else{
                       //신주소
                        inHtml = inHtml + '<div class="newId">가입된 정보가 존재하지않습니다.</div>';;
                  
                   }
                   
                   $("#newIdList").html(inHtml);
               }
           );    

    
}



function loginView(){
    var frm = $("#findNewIdForm")[0];
     frm.action="<c:url value='/mbr/loginView.do'/>";
    
    frm.submit();   
}
</script>

<body>





<div id="wrap" class="non-subnavigation02">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />

    <%@ include file="/WEB-INF/jsp/com/include/sub_header_global01.jspf" %>
    <hr />



<form id="findNewIdForm" name="findNewIdForm" method="post" onsubmit="return false">
	<div id="container">
		<div id="subtitle-area">
        <div class="subtitle-area-inner">
			<%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
		</div>
        </div>
    </div>
		<div id="article" >
        <div id="findView" name="findView">
			<h4 class="in-contents"><img src="/kr/images/title/h4_global_menu01_01.gif" alt="이메일 아이디 성명, 휴대폰 번호 이용" /></h4>
			<p><img src="/kr/images/title/h4_global_menu01_01_desc.gif" alt="회원가입 시  등록하신 정보로 회원님의 이메일 아이디를 찾습니다." /></p>
			<div class="boardwrite-wrap02 subsection02" >
				<table summary="통신사 선택, 휴대전화 번호">
				<caption>휴대전화 정보 작성</caption>
				<colgroup>
					<col width="13%" />
					<col width="87%" />
				</colgroup>
				<tbody>
				<tr>
					<th scope="row"><img src="/kr/images/global_menu/txt_global_menu01_01_03.gif" alt="성명" /></th>
					<td>
						<input type="text" class="txt" style="width:217px;" name="mbrNm" id="mbrNm" />
					</td>
				</tr>
				<tr>
					<th scope="row"><img src="/kr/images/global_menu/txt_global_menu01_01_02.gif" alt="휴대전화 번호" /></th>
					<td>

                        <select class="select select-type1" style="width:56px;" name="mobileCom" id="mobileCom">
                            <option value="010" selected>010</option>
                            <option value="011">011</option>
                            <option value="016">016</option>
                            <option value="017">017</option>
                            <option value="018">018</option>
                            <option value="019">019</option>
                         
                        </select>
						-
						<input type="text" class="txt" style="width:61px;"  maxlength="4" name="telPrx" id="telPrx" onKeyup="numbersOnly(this)"/>
						-
						<input type="text" class="txt" style="width:61px;" maxlength="4" name="telTail" id="telTail" onKeyup="numbersOnly(this)"/>
						<input type="image" src="/kr/images/common/button/btn_id_find.gif" alt="아이디 찾기" onClick="findNewId()"/>
					</td>
				</tr>
				</tbody>
				</table>
			</div>
            </div>


        <div name="findIdRst" id="findIdRst" style="display:none">
			<!-- id find result area  -->
			<h4 class="in-contents"><img src="/kr/images/title/h4_global_menu01_03.gif" alt="이메일 아이디 찾기" /></h4>
			<p><img src="/kr/images/title/h4_global_menu01_03_desc.gif" alt="회원님이 입력하신 정보로 찾은 이메일 아이디 입니다. 정보보안을 위하여 최초 1,2번째 문자는 숨김 처리 되었습니다" /></p>
			<p class="subsection02 id-find-result" id="newIdList" name="newIdList">
			</p>
			<div class="btnwrap">
				<a href="#"><img src="/kr/images/common/button/btn_confirm.gif" alt="확인" onClick="loginView()"/></a>
			</div>
			<!-- //id find result area  -->
		</div>
           </div>
    </form>
	</div>
	<hr />



    </body>
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %>